package com.tengniu.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 用户状态
 *
 * @author lmq
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum MessageType {

    REGISTER(1, "注册验证码"),
    LOGIN(2, "登录验证码"),
    VALID(3, "校验验证码");

    private Integer code;

    private String desc;

    public static MessageType getMessageTypeByCode(Integer code) {
        for (MessageType gradeEnum : MessageType.values()) {
            if (gradeEnum.getCode().equals(code)) {
                return gradeEnum;
            }
        }
        return null;
    }
}
